//
//  UIView+IBInsepectable.swift
//  SinaWeibo
//
//  Created by 李子海LEO on 4/6/16.
//  Copyright © 2016 李子海LEO. All rights reserved.
//

import UIKit

extension UIView {
    
    @IBInspectable var cornerRadius:CGFloat{
        
        get{

            
            return layer.cornerRadius
            
        }
        
        set{
        
            layer.cornerRadius=newValue
            
            
            if newValue>0 {
                
                layer.masksToBounds=true
                
            }else{
            
                layer.masksToBounds=false
                
            }
        
        }
        
    }
    
    @IBInspectable var borderWidth:CGFloat{
        
        get{

            return layer.borderWidth
            
        }
        
        set{
            
            
            layer.borderWidth=newValue
            
        }
        
    }
    
    @IBInspectable var boederColor:UIColor?{
        
        get{
            
            if let color=layer.borderColor {
                
                
                return UIColor(CGColor: color)
                
            }
            return nil
        
        }
        
        set{
            
            
            layer.borderColor=newValue?.CGColor
        
        
        }
    
    
    
    }

}
